class Solution {
public:
    int minNumberInRotateArray(vector<int> rotateArray) {
        int left = 0;
        int right = rotateArray.size() - 1;
        int mid = 0;
        while (left <= right)
        {
            mid = (right - left) / 2 + left;
            if (rotateArray[mid] < rotateArray[right])
                right = mid;
            else if (rotateArray[mid] > rotateArray[right])
                left = mid + 1;
            else
                --right;
        }
        return rotateArray[left];
    }
};